//
//  ZZTabBarVC.swift
//  QMXK
//
//  Created by jenkin on 2018/12/3.
//  Copyright © 2018年 jenkin. All rights reserved.
//

import UIKit

class ZZTabBarVC: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.setUI()
    }
    
    func setUI(){
        let homeVC:ZZHomeVC! = ZZHomeVC.init()
        self.setChildVC(vc: homeVC, title: "资讯", icon: "Information_gray_icon", selectIcon: "Information_icon")
        let videoVC:ZZVideoVC! = ZZVideoVC.init()
        self.setChildVC(vc: videoVC, title: "视频", icon: "video_gray_icon", selectIcon: "video_icon")
        let taskVC:ZZTaskVC! = ZZTaskVC.init(tableStyle: UITableView.Style.plain, tableFrame: CGRect.zero)
        self.setChildVC(vc: taskVC, title: "任务", icon: "task_gray_icon", selectIcon: "task_icon")
        let personVC:ZZPersonVC  = ZZPersonVC.init()
        self.setChildVC(vc: personVC, title: "我的", icon: "me_gray_icon", selectIcon: "me_icon")
        self.tabBar.tintColor = UIColor.init(red: 250.0/255, green: 80.0/255, blue: 1.0/255, alpha: 1)
    }
    
    func setChildVC(vc:UIViewController!, title:String!, icon:String!, selectIcon:String!){
        let nav:ZZBaseNav = ZZBaseNav.init(rootViewController: vc)
        nav.tabBarItem.title = title
        nav.tabBarItem.image = UIImage.init(named: icon)
        nav.tabBarItem.selectedImage = UIImage.init(named: selectIcon)
        self.addChild(nav)
    }
}
